<template>
  <div>
    <h2>事件消息：{{ message }}</h2>
  </div>
</template>

<script>
// import { EventBus } from '../utils/event-bus.js';

export default {
  name: 'ListenView',
  data() {
    return {
      message: ''
    };
  },
  created() {
    this.$bus.$on('my-event', this.listenEvent);
  },
  methods: {
    listenEvent(msg) {
      this.message = msg;
    }
  },
  beforeDestroy() {
    this.$bus.$off('my-event', this.listenEvent);
  }
}
</script>

<style scoped></style>
